<!DOCTYPE html>
<html lang="zh-CN">
<head>

<#include "bases/global_style.ftl">
<#include "bases/global_js.ftl">
<#include "bases/combo.ftl">

	<style type="text/css">
         label{width: 70px;text-align: left;}
         table 
		{ 
			margin-left: auto; 
			margin-right: auto; 
		} 
    </style>
    
	<script>
		var curent_page=${currentpage};

		//套餐显示详情
		function showComboDetails(){
			 $(".am-comboBtn").on("mouseover",function(event){
				var thisItem=$(this);
				  //鼠标悬浮
				  thisItem.next().find(".am-comboContent").css("display","block");
				  $(".am-obligate").css("display","block");
			});
			$(".am-comboBtn").on("mouseout",function(event){
				var thisItem=$(this);
				  //鼠标离开
				  thisItem.next().find(".am-comboContent").css("display","none");
				  $(".am-obligate").css("display","none");
				  $(".am-comboDetails div").empty();
			});
		}

		function showInfo(id)
		{
			$.ajax({
				type : "POST",
				url : CONTEXT+'/get_cartype?companyid='+id,
				dataType : "json",  
	      	    cache : false,  
	      	    async : false,
	      	  	success : function(data) {
		      	  	if(data.length==0){
		      	  		$(".am-comboDetails").append("<div><span>该公司未添加车型</span></div>");
			      	}else{
			      		for(var i=0;i<data.length;i++){
				      	  	$.ajax({
					      	  	type : "POST",
					      	  	url : CONTEXT+'/get_postage_by_id?cartype='+data[i].id+'&accountid='+id,
					      	  	dataType : "json",  
					      	    cache : false,  
					      	    async : false,
					      	  	success : function(d) {
						      	  	if(d.length==0){
						      	  		$(".am-comboDetails").append("<div><span>"+data[i].name+"</span><span>未匹配</span></div>");
							      	}else if(d[0].type==1){
							      		$(".am-comboDetails").append("<div><span>"+data[i].name+"</span><span>"+d[0].name+"</span></div>");
								    }else{
								    	$(".am-comboDetails").append("<div><span>"+data[i].name+"</span><span>"+d[0].value+"</span></div>");
									}
						      	  	showComboDetails();
					      	  	}
					      	});
				      	}
				    }
	      	  	}
			});
		}

		function ChoseBrand(value,text)//非自有选择车牌
		{
			document.getElementById('addCarbrand').value = text;
			document.getElementById('addCarid').value = value;
			$.ajax({
				type : "POST",
				url : CONTEXT+'/get_cartypeid?id='+value,
				dataType : "json",  
	      	    cache : false,  
	      	    async : false,
	      	  	success : function(data) {
		      	  	$("#addCarType").val(data);
	      	  		$("#addCartype option[value='"+data+"']").attr("selected","selected");
	      	  		$("#addCartype").attr("disabled","disabled");
	      	  	}
			});
		}
		
		function doDeleteTableRow(id)//单个删除
		{
			jConfirm('确定删除该对象?', '提示', function(r) {
				if(r==true){
					$("#searchform").attr("action","${base}/batchdel_account_user?idStr="+id);
		    		$("#searchform").submit();
				}
			});
		}

		function qrcode(account,name)//生成二维码
		{
			$("#code").qrcode({render:"table",width:200,height:200,text:account});
			$("#qrcode #account").text(account);
			$("#name").text(name);
			showPopup("qrcode");
		}
			
		function batchDel()//批量删除
		{
			var index=$(".list-checkbox:checked").size();
			if(index==0){
				jAlert('未勾选要删除的对象', '提示');
    		}else{
    			jConfirm('确定删除选中的对象?', '提示', function(r) {

    				if(r==true){
    					$("#searchform").attr("action","${base}/batchdel_account_user?idStr="+getCheckedIds());
    		    		$("#searchform").submit();
    				}
    			});
    		}
		}
		//批量匹配资费
		function batchPostage(id,type)
		{
			$.ajax({
				type : "POST",
	        	url : CONTEXT+'/get_cartypelist_by_id?id='+id+'&type='+type,
	        	dataType : "json",  
	      	    cache : false,  
	      	    async : false,
	      	    success : function(data) {
		      	    if(data.length!=0){
		      	      	if(data[0].sql=='private'){//个人
				      	    $("#cartype").append("<option value='"+data[0].key+"'>"+data[0].name+"</option>");
			      	    }else{//公司
					      	for(var i=0;i<data.length;i++){
					      	    $("#cartype").append("<option value='"+data[i].key+"'>"+data[i].name+"</option>");
						    }
				      	}
				      	$("#accountid").val(id);
		      	      	showPopup("postageDiv");
			      	}else{
			      	    jAlert("该公司未绑定车辆","提示");
				    }
		      	}
			})
		}

		//批量发放活动
		function batchActivity()
		{
			var index=$(".list-checkbox:checked").size();
			if(index==0){
				jAlert("未勾选要发放活动的对象","提示");
			}else{
				showPopup("couponDiv");
			}	
		}

		function Activity(id)//单个发放活动
		{
			showPopup("couponDiv");
			$("#accid").val(id);
		}

		function addCoupon()
		{
			var index=$(".list-checkbox:checked").size();
			var ids;
			if(index==0){
				ids = $("#accid").val();
			}else{
				ids = getCheckedIds();
			}
			couponformv.form();
	   		if(couponformv.valid()){
	   			$.getJSON("${base}/batch_add_coupon?idStr="+ids+"&couponid="+$("#couponid option:selected").val(),
                function(data)
                {
                    if(data==1) {
                    	jConfirm('发放成功！', '提示', function(r) {
                        	
                    		if(r==true){
                    			location.href='${base}/account_user_manage';
                    		}else{
                    			location.href='${base}/account_user_manage';
                        	}
                    	});
                    }
                    else {
                    	jAlert("未知错误！");
                	}
                });
	   		}
		}

		function matchPostage()//匹配资费
		{
			postageformv.form();
			if(postageformv.valid()){
				$.getJSON("${base}/match_postage?"+$("#postageForm").serialize(),
				function(data)
				{
					if(data==1) {
						jAlert("匹配成功！");
                        location.href='${base}/account_user_manage';
                    }
                    else {
                    	jAlert("未知错误！");
                	}
				});
			}
		}
 
    	var addformv,editpformv,editcformv,couponformv,postageformv,bindformv,unbindformv;
    	jQuery(document).ready(function()
    	{
    		var optInit = getOptionsFromForm();
    		$("#Pagination").pagination(${totalRecord}, optInit);
    		App.init();
    		combox("addProvince","Province",null,null,false);
            combox('addCity','City',$("#addProvince").val(),null,false);
            combox("editProvince","Province",null,null,false);
            //combox('editCity','City',$("#editProvince").val(),null,false);
 
    		combox("addProvince","Province",null);
            combox('addCity','City',$("#addProvince").val());
            combox("editProvince","Province",null);
            //combox('editCity','City',$("#editProvince").val());
 
            addformv=$("#addForm").validate({
                debug:true //只验证不提交表单
            });
            editpformv=$("#editPForm").validate({
                debug:false //只验证不提交表单
            });
            editcformv=$("#editCForm").validate({
                debug:false //只验证不提交表单
            });
            couponformv=$("#couponForm").validate({
                debug:false
            });
            postageformv=$("#postageForm").validate({
                debug:true
            });
            bindformv=$("#bindForm").validate({
                debug:false
            });
            unbindformv=$("#unbindForm").validate({
                debug:false
            });
            
    		//个人公司切换
    		$(".role1Btn").change(function() {
    				var $selectedvalue = $("input[name='type']:checked").val();
    				if ($selectedvalue == 0) {
        				$(".private").css("display","");
        				$(".company").css("display","none");
        				$("input[name=self]").val(["1"]);
        				$(".notself").css("display","none");
    				}else {
    					$(".private").css("display","none");
        				$(".company").css("display","");
    				}
    		});
    		//自有非自有切换
    		$(".carBtn").change(function() {
        		var selectedvalue = $("input[name='self']:checked").val();
        		if(selectedvalue == 1) {//自有
        			$(".self").css("display","");
    				$(".notself").css("display","none");
    				$("#addCartype").removeAttr("disabled");
            	}else{//非自有
            		$(".self").css("display","none");
    				$(".notself").css("display","");
                }
        	});
    		//常规套餐资费切换
    		$(".role2Btn").change(function() {
    			var $selectedvalue = $("input[name='postageType']:checked").val();
    			if ($selectedvalue == 1) {
    				$(".conventional").css("display","");
    				$(".package").css("display","none");
        		}else {
        			$(".conventional").css("display","none");
    				$(".package").css("display","");
            	}
        	})
        	$("#cartype").change(function(){
            	var cartype=$(this).children('option:selected').val();
            	var accountid=$("#accountid").val();
        		//alert($(this).children('option:selected').val());
        		$.ajax({
        			type : "POST",
            		url : CONTEXT+'/get_postage_by_cartype?cartype='+cartype+'&accountid='+accountid,
            		dataType : "json",  
          	        cache : false,  
          	        async : false,
          	      	success : function(data){
              	      	if(data > 0){
              	      		$(".error-bar").css("display","");
              	      		$("#action").val(1);//修改操作
                  	    }else{
                  	    	$(".error-bar").css("display","none");
                  	    	$("#action").val(2);//添加操作
                      	}
              	    }
            	});
            });
	   	});

	   	//银行账号验证
	   	jQuery.validator.addMethod("banknum", function (value, element) {
		   	var banknum = /^(\d{4}[\s\-]?){4,5}\d{3}$/g;
		   	return this.optional(element) || (banknum.test(value));
	   	}, "银行卡号格式不正确");
		
		//车牌号验证
		jQuery.validator.addMethod("plate", function (value, element) {
			var plate = /^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4}[A-Z0-9挂学警港澳]{1}$/;
			return this.optional(element) || (plate.test(value));
		}, "车牌号格式不正确");

	   	function addEntity()
	   	{
	   		addformv.form();
	   		if(addformv.valid()){
	   			var a ;
                var nowtime = new Date();
                var strtemp = ""+nowtime.getHours()+nowtime.getMinutes()+nowtime.getSeconds()+nowtime.getMilliseconds();
                a=strtemp;

    	          $.getJSON("${base}/add_account_user/" + a+
                          "?"+$("#addForm").serialize()
                  ,
                  function(data)
                  {
                      if(data ==1) {
                          alert("添加成功！");
                          location.href='${base}/account_user_manage';
                      }
                      else if(data ==-11)
                          alert("未知错误！");
                  });
	   		}
		}

	   	function updateCTable()
		{
			editcformv.form();
	   		if(editcformv.valid()){ 
	             $.ajax({  
	       	        type : "POST",  
	       	        url : CONTEXT+'/edit_company_account_user',  
	       	        data:$("#editCForm").serialize(),
	       	        dataType : "json",  
	       	        success : function(data) {  
		       	        	if(data.result==true){
		                        window.location.reload();
		       	        	}else{
		       	        		jAlert(data.msg);
		       	        	}
	       	        }  
	       	    });
	   		}
		}

		function updatePTable()
		{
			editpformv.form();
	   		if(editpformv.valid()){
	   			$("#editPForm").submit();
		   	}
		}

    	function pageselectCallback(page_index, jq)
        {
            if (curent_page != page_index)
            {
                $("#currentpage").val(page_index);
                $("#searchform").submit();
                return true;
            }
        }

    	function showEditDiv(id)
    	{
    		edit_account_id = id;
    		$.ajax({
        		type : "POST",
        		url : CONTEXT+'/get_accountuser_by_id?id='+id,
        		dataType : "json",  
      	        cache : false,  
      	        async : false,
      	      	success : function(data) {
          	      	if(data.type==0){//个人
              	      	$.ajax({
                  	      	type : "POST",
                  	      	url : CONTEXT+'/get_self_by_id?id='+id,
                  	      	dataType : "json",  
                	        cache : false,  
                	        async : false,
                	        success : function(data) {
                    	        if(data.self==1){//自有
                    	        	$("#radio7").attr("checked","checked");
                    	        	$("#radio8").removeAttr("checked","checked");
                        	    }else{//非自有
                        	    	$("#radio7").removeAttr("checked","checked");
                    	        	$("#radio8").attr("checked","checked");
                            	}
                	        }
                  	    });
          	      		var url1="${base}/checkNameUnique?category=AccountUserTel&where=and del=0 and id<>"+data.id;
          	      		var url3="${base}/checkNameUnique?category=AccountUserLoginName&where=and del=0 and id<>"+data.id;
          	      		var url4="${base}/checkNameUnique?category=AccountUserName&where=and del=0 and id<>"+data.id;
              	      	$("#editPDiv #editPId").val(data.id);
              	      	$("#editPDiv #editPAccount").text(data.account);
              	      	$("#editPDiv #editPType").text("个人");
              	      	$("#editPDiv #editName").val(data.name);
              	      	$("#editPDiv #editPTel").attr("data-rule-remote",url1);
              	      	$("#editPDiv #editPTel").attr("data-msg-remote","手机号码已存在");
              	      	$("#editPDiv #editPTel").val(data.tel);
              	      	$("#editPDiv #editPIdentity").val(data.identityid);
              	      	$("#editPDiv #editProvince option[value='"+data.provinceid+"']").attr("selected", true);  
  	      	        	$("#editPDiv #editProvince").trigger("change");
  	      	        	$("#editPDiv #editCity option[value='"+data.cityid+"']").attr("selected", true);
  	      	        	showPopup("editPDiv");
              	    }else{//公司
              	    	var url2="${base}/checkNameUnique?category=AccountUserTel&where=and del=0 and type=0 and id<>"+data.id;
                  	    $("#editCDiv #editCId").val(data.id);
                  	    $("#editCDiv #editCAccount").text(data.account);
                  	    $("#editCDiv #editCType").text("公司");
                  	    $("#editCDiv #editCName").val(data.name);
                  	  	$("#editCDiv #editCTel").attr("data-rule-remote",url2);
            	      	$("#editCDiv #editCTel").attr("data-msg-remote","手机号码已存在");
                  	    $("#editCDiv #editCtel").val(data.tel);
                  	    $("#editCDiv #editBankNum").val(data.bank_num);
                  	    $("#editCDiv #editBankAcc").val(data.bank_account);
                  	    $("#editCDiv #editComment").val(data.comment);
                  	    showPopup("editCDiv");
                  	}
      	      	}
        	});
        }

        function bind()
        {//绑定
        	bindformv.form();
	   		if(bindformv.valid()){
	   			$.getJSON("${base}/bind_car?"+$("#bindForm").serialize(),
	   			function(data) {
	   				if(data.result == true) {
	   					jAlert("绑定成功！","提示", function() {
	    		    		window.location.reload();
	        		    });
	   				}else{
	   					jAlert(data.msg);
		   			}
	   			});
	   		}
        }

        function unbindCar()
        {//解绑
        	unbindformv.form();
        	if(bindformv.valid()){
        		$.getJSON("${base}/unbind_car?"+$("#unbindForm").serialize(),
                function(data) {
        			if(data.result == true) {
	   					jAlert("解绑完成,14天后将自动解绑！","提示", function() {
	    		    		window.location.reload();
	        		    });
	   				}else{
	   					jAlert(data.msg);
		   			}
                });
        	}
        }

        function immediateUnbind()
        {//立即解绑
        	unbindformv.form();
        	if(bindformv.valid()){
        		$.getJSON("${base}/immediate_unbind_car?"+$("#unbindForm").serialize(),
        		function(data) {
        			if(data.result == true) {
	   					jAlert("解绑成功！","提示", function() {
	    		    		window.location.reload();
	        		    });
	   				}else{
	   					window.location.reload();
		   			}
        		});
        	}
        }

        function showBind(id)
        {//弹出绑定
        	$.ajax({
            	type : "POST",
        		url : CONTEXT+'/get_accountuser_by_id?id='+id,
        		dataType : "json",  
      	        cache : false,  
      	        async : false,
      	      	success : function(data) {
      	      		$("#bindDiv #bindAccount").text(data.account);
      	      		$("#bindDiv #bindType").text("个人");
      	      		$("#bindDiv #bindName").text(data.name);
      	      		$("#bindDiv #bindTel").text(data.tel);
      	      	}
        	});
        	$("#bindDiv #bindId").val(id);
        	combox("notSelf","CarBrandList",null,null,false);
   		 	$("#notSelf").chosen({
   			 
   			 	no_results_text: "没有找到"
   		 
   		 	}).change(function(){
   		 		ChoseBrand($('#notSelf option:selected').val(),$('#notSelf option:selected').text());
   		 	});
        	showPopup("bindDiv");
        }

        function showUnbind(id)
        {//弹出解绑
            $.ajax({
            	type : "POST",
        		url : CONTEXT+'/get_accountuser_by_id?id='+id,
        		dataType : "json",  
      	        cache : false,  
      	        async : false,
      	      	success : function(data) {
      	      		$.ajax({
          	      		type : "POST",
          	      		url : CONTEXT+'/get_self_by_id?id='+id,
          	      		dataType : "json",  
        	        	cache : false,  
        	        	async : false,
        	        	success : function(data) {
        	        		$("#unbindDiv #unbindSelf").val(data.self);
            	        	if(data.self==1){//自有
            	        		$("#radio7").attr("checked","checked");
            	        		$("#radio8").removeAttr("checked","checked");
                	    	}else{//非自有
                	    		$("#radio7").removeAttr("checked","checked");
            	        		$("#radio8").attr("checked","checked");
            	        		$("#unbindCarid").val(data.carid);
                    		}
        	        	}
          	    	});
      	      		if(data.free==1){
      	      			$("#1").prop("checked",true);
  	      				$("#firstfee").css("display","");
    					$("#lastfee").css("display","");
  	  	      		}else if(data.free==2){
  	  	      			$("#2").prop("checked",true);
  	  	      			$("#firstfee").css("display","");
    					$("#lastfee").css("display","none");
  	  	  	    	}else if(data.free==3){
  	  	  	    		$("#3").prop("checked",true);
  	  	  	  			$("#firstfee").css("display","none");
  						$("#lastfee").css("display","");
  	  	  	  		}else{
  	  	  	  			$("#4").prop("checked",true);
  	  	  	  			$("#firstfee").css("display","none");
  		    			$("#lastfee").css("display","none");
  	  	  	  		}
      	      		$("#unbindDiv #unbindFirstfee").val(data.firstfee/100);
      	      		$("#unbindDiv #unbindLastfee").val(data.lastfee/100);
      	      		$("#unbindDiv #unbindAccount").text(data.account);
  	      			$("#unbindDiv #unbindType").text("个人");
  	      			$("#unbindDiv #unbindName").text(data.name);
  	      			$("#unbindDiv #unbindTel").text(data.tel);
      	      		$("#unbindDiv #unbindId").val(data.id);
	        		$("#unbindDiv #editPCarbrand").val(data.carbrand);
	        		$("#unbindDiv #unbindCarid").val(data.carid);
      	      		$("#unbindDiv #editPCartype option[value='"+data.cartypeid+"']").attr("selected", true);
      	      		$("#unbind").show();
      	      		$("#immediate").hide();
      	      		showPopup("unbindDiv");
      	      	}
            });
        }

        function showImmediate(id)
        {//弹出立即解绑
        	$.ajax({
            	type : "POST",
        		url : CONTEXT+'/get_accountuser_by_id?id='+id,
        		dataType : "json",  
      	        cache : false,  
      	        async : false,
      	      	success : function(data) {
      	      		$.ajax({
          	      		type : "POST",
          	      		url : CONTEXT+'/get_self_by_id?id='+id,
          	      		dataType : "json",  
        	        	cache : false,  
        	        	async : false,
        	        	success : function(data) {
        	        		$("#unbindDiv #unbindSelf").val(data.self);
            	        	var d=new Date(data.unbinddate);
            	        	var a=new Date(data.unbinddate+14*24*60*60*1000);
            	        	if(data.self==1){//自有
            	        		$("#radio7").attr("checked","checked");
            	        		$("#radio8").removeAttr("checked","checked");
                	    	}else{//非自有
                	    		$("#radio7").removeAttr("checked","checked");
            	        		$("#radio8").attr("checked","checked");
            	        		$("#unbindCarid").val(data.carid);
                    		}
                    		$("#date").css("display","");
                    		$("#age").css("display","");
            	        	$("#unbindDiv #unbindDate").text(d.pattern('yyyy-MM-dd'));
            	        	$("#unbindDiv #unbindAge").text(a.pattern('yyyy-MM-dd'));
            	        	$("#unbindDiv #unbindReason").val(data.unbindreason);
            	        	$("#unbindReason").attr("readonly","readonly");
        	        	}
          	    	});
      	      		if(data.free==1){
      	      			$("#1").prop("checked",true);
  	      				$("#firstfee").css("display","");
    					$("#lastfee").css("display","");
  	  	      		}else if(data.free==2){
  	  	      			$("#2").prop("checked",true);
  	  	      			$("#firstfee").css("display","");
    					$("#lastfee").css("display","none");
  	  	  	    	}else if(data.free==3){
  	  	  	    		$("#3").prop("checked",true);
  	  	  	  			$("#firstfee").css("display","none");
  						$("#lastfee").css("display","");
  	  	  	  		}else{
  	  	  	  			$("#4").prop("checked",true);
  	  	  	  			$("#firstfee").css("display","none");
  		    			$("#lastfee").css("display","none");
  	  	  	  		}
      	      		$("#unbindDiv #unbindFirstfee").val(data.firstfee/100);
      	      		$("#unbindDiv #unbindLastfee").val(data.lastfee/100);
      	      		$("#unbindDiv #unbindAccount").text(data.account);
      	      		$("#unbindDiv #account").val(data.account);
  	      			$("#unbindDiv #unbindType").text("个人");
  	      			$("#unbindDiv #unbindName").text(data.name);
  	      			$("#unbindDiv #unbindTel").text(data.tel);
      	      		$("#unbindDiv #unbindId").val(data.id);
	        		$("#unbindDiv #editPCarbrand").val(data.carbrand);
	        		$("#unbindDiv #unbindCarid").val(data.carid);
      	      		$("#unbindDiv #editPCartype option[value='"+data.cartypeid+"']").attr("selected", true);
      	      		$("#unbind").hide();
  	      			$("#immediate").show();
      	      		showPopup("unbindDiv");
      	      	}
            });
        }

    	function showPopup(div) 
        {//弹出层
            var backDiv = document.getElementById("backDiv");
            backDiv.style.top = "0%";//设置弹出层距离上边界的距离
            backDiv.style.left = "0%";//设置弹出层距离左边界的距离
            backDiv.style.width = "100%";//设置弹出层的宽度
            backDiv.style.height = "100%";//设置弹出层的高度
            backDiv.style.visibility = "visible";

            var addDiv = document.getElementById(div);
            addDiv.style.top = "10%";//设置弹出层距离上边界的距离
            addDiv.style.left = "30%";//设置弹出层距离左边界的距离
            addDiv.style.width = "40%";//设置弹出层的宽度
            addDiv.style.height = "auto";//设置弹出层的高度
            addDiv.style.visibility = "visible";
 
        }

    	function hideEditTable() 
        {//关闭层
        	addformv.resetForm();
            var backDiv = document.getElementById("backDiv");
            backDiv.style.visibility = "hidden";

            var addDiv = document.getElementById("addDiv");
            addDiv.style.visibility = "hidden";

        }

    	function hidePopup() 
        {//关闭层
 
            // resetLabel();
            var backDiv = document.getElementById("backDiv");
            backDiv.style.visibility = "hidden";

            var addDiv = document.getElementById("addDiv");
            addDiv.style.visibility = "hidden";

            var editPDiv = document.getElementById("editPDiv");
            editPDiv.style.visibility = "hidden";

            var editCDiv = document.getElementById("editCDiv");
            editCDiv.style.visibility = "hidden";

            var couponDiv = document.getElementById("couponDiv");
            couponDiv.style.visibility = "hidden";

            var postageDiv = document.getElementById("postageDiv");
            postageDiv.style.visibility = "hidden";

            var bindDiv = document.getElementById("bindDiv");
            bindDiv.style.visibility = "hidden";

            var unbindDiv = document.getElementById("unbindDiv");
            unbindDiv.style.visibility = "hidden";

            var qrcodeDiv = document.getElementById("qrcode");
            qrcodeDiv.style.visibility = "hidden";
        }

    	function allDivHide() 
        {
            hidePopup();
            hideEditTable();
            $("#date").css("display","none");
    		$("#age").css("display","none");
    		$("#unbindReason").removeAttr("readonly");
    		$("#unbindReason").val('');
            $("#cartype").empty();
            $("#code").empty();
            $("#cartype").append("<option value=''>===请选择车型===</option>");
        }

        function fresh()
        {
        	allDivHide();
        	$(".private").css("display","");
			$(".company").css("display","none");
			$("input[name=self]").val(["0"]);
        }
	</script>
</head>
<!-- END HEAD -->
<!-- BEGIN BODY -->
<body>
	<!-- END HEADER -->
	
	<div id="backDiv" onclick="allDivHide()" style="position: absolute;visibility: hidden;position:fixed;overflow: hidden;solid: #000000;background-color: #000000;padding: 1px;z-index: 99;filter:alpha(opacity=50);opacity: 0.5;"></div>
	
	<!-- 绑定车辆 -->
	<div id="bindDiv" class="row-fluid" style="position: absolute;visibility: hidden;overflow: hidden;padding: 1px;z-index: 100;background-color: #FFFFFF;">
		<div class="span12">
			<div class="portlet box green" style="padding: 0px;margin:0px;">
				<div class="portlet-title">
					<div class="caption"><i class="fa fa-edit"></i>绑定车辆</div>
                    <a href="javascript:allDivHide();" class="remove"></a>
				</div>
				
				<div class="portlet-body flip-scroll">
					<form id="bindForm" action="<@spring.url '/account_user_manage'></@spring.url>" method="POST">
						<table class="table-bordered table-striped table-condensed flip-content">
							<tbody role="alert" aria-live="polite" aria-relevant="all">
							<input type="hidden" id="bindId" name="id"/>
								<tr class="even">
            						<td style="text-align: right;">账号</td>
            						<td class="even">
            							<span id="bindAccount"></span>
            						</td>
            					</tr>
            					<tr class="even">
            						<td style="text-align: right;">账户类型</td>
            						<td class="even">
            							<span id="bindType"></span>
            						</td>
            					</tr>
            					<tr class="even">
            						<td style="text-align: right;">所属个人</td>
            						<td class="even">
            							<span id="bindName"></span>
            						</td>
            					</tr>
            					<tr class="even">
            						<td style="text-align: right;">手机号</td>
            						<td class="even">
            							<span id="bindTel"></span>
            						</td>
            					</tr>
								<tr class="even private">
                					<td style="text-align: right;">车辆类型<span class="fill-must">*</span></td>
                					<td class="center">
                						<label class="radio-inline">
				  							<input type="radio" name="self" class="carBtn" id="radio6" value="0" checked="checked" required> 非自有
										</label>
                						<label class="radio-inline">
				  							<input type="radio" name="self" class="carBtn" id="radio5" value="1" required> 自有
										</label>
                					</td>
                				</tr>
                				<tr class="even self private" style="display: none;">
                					<td style="text-align: right;">车牌号<span class="fill-must">*</span></td>
                					<td id="checkcar" class="even">
                						<input class="m-wrap span8" style="margin-top: 10px" type="text" id="self" name="selfBrand" required placeholder="请输入车牌号" data-rule-plate="true" data-msg-plate="请输入正确格式"/>
                					</td>
                				</tr>
                				<tr class="even notself private">
                					<td style="text-align: right;">车牌号<span class="fill-must">*</span></td>
                					<td class="even">
                						<input type="hidden" id="addCarbrand" name="carbrand" value=""/>
                						<input type="hidden" id="addCarid" name="carid" value=""/>
                						<select class="m-wrap span8" style="margin-top: 10px;width: 260px;height: 40px" id="notSelf" name="carid" required>
                						</select>
                					</td>
                				</tr>
                				<tr class="even private">
                					<td style="text-align: right;">车型<span class="fill-must">*</span></td>
                					<td class="even">
                						<input type="hidden" id="addCarType" name="cartypeid" value="">
                						<select id="addCartype" name="cartype" class="m-wrap span8" style="margin-top: 10px" placeholder="" required>
                							<option value="">===请选择===</option>
											<#if cartypeList?exists>
												<#list cartypeList as ctlist>
													<option value="${ctlist.getKey()}"><#if ctlist.getName()?exists>${ctlist.getName()}</#if></option>
												</#list>
											</#if>
                						</select>
                					</td>
                				</tr>
                				<tr class="even private">
                					<td style="text-align: right;">初始里程<span class="fill-must">*</span></td>
                					<td class="even">
                						<input class="m-wrap span8" style="margin-top: 10px" type="text" id="initmile" name="initmile" required placeholder="请输入初始里程"/>
                					</td>
                				</tr>
							</tbody>
						</table>
						<div class="controls controls-row" style="text-align: right;">
                        	<input type="button" value="绑定" class="btn green" onclick="bind()"/>
                        	<input type="button" value="取消" class="btn green" onclick="allDivHide()" />
                    	</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	
	<!-- 解绑车辆 -->
	<div id="unbindDiv" class="row-fluid" style="position: absolute;visibility: hidden;overflow: hidden;padding: 1px;z-index: 100;background-color: #FFFFFF;">
		<div class="span12">
			<div class="portlet box green" style="padding: 0px;margin:0px;">
				<div class="portlet-title">
					<div class="caption"><i class="fa fa-edit"></i>解绑车辆</div>
                    <a href="javascript:allDivHide();" class="remove"></a>
				</div>
				
				<div class="portlet-body flip-scroll">
					<form id="unbindForm" action="<@spring.url '/account_user_manage'></@spring.url>" method="POST">
						<table class="table-bordered table-striped table-condensed flip-content">
							<tbody role="alert" aria-live="polite" aria-relevant="all">
							<input type="hidden" id="unbindId" name="id"/>
							<input type="hidden" id="unbindSelf" name="self"/>
							<input type="hidden" id="account" name="account"/>
								<tr class="even">
            						<td style="text-align: right;">账号</td>
            						<td class="even">
            							<span id="unbindAccount"></span>
            						</td>
            					</tr>
            					<tr class="even">
            						<td style="text-align: right;">账户类型</td>
            						<td class="even">
            							<span id="unbindType"></span>
            						</td>
            					</tr>
            					<tr class="even">
            						<td style="text-align: right;">所属个人</td>
            						<td class="even">
            							<span id="unbindName"></span>
            						</td>
            					</tr>
            					<tr class="even">
            						<td style="text-align: right;">手机号</td>
            						<td class="even">
            							<span id="unbindTel"></span>
            						</td>
            					</tr>
            					<tr id="date" class="even" style="display:none;">
            						<td style="text-align: right;">申请解绑时间</td>
            						<td class="even">
            							<span id="unbindDate" class="fill-must"></span>
            						</td>
            					</tr>
            					<tr id="age" class="even" style="display:none;">
            						<td style="text-align: right;">解绑时效至</td>
            						<td class="even">
            							<span id="unbindAge" class="fill-must"></span>
            						</td>
            					</tr>
								<tr class="even private">
                					<td style="text-align: right;">车辆类型<span class="fill-must">*</span></td>
                					<td class="center">
                						<label class="radio-inline">
				  							<input type="radio" name="self" class="carBtn" id="radio8" value="0" checked="checked" disabled="disabled"> 非自有
										</label>
                						<label class="radio-inline">
				  							<input type="radio" name="self" class="carBtn" id="radio7" value="1" disabled="disabled"> 自有
										</label>
                					</td>
                				</tr>
            					<tr class="even">
            						<td style="text-align: right;">车牌号<span class="fill-must">*</span></td>
            						<td id="checkeditcar" class="even">
            							<input class="m-wrap span8" style="margin-top: 10px" type="text" id="editPCarbrand" name="carbrand" placeholder="请输入车牌号" readonly="true" data-rule-plate="true" data-msg-plate="请输入正确格式"/>
            							<input type="hidden" id="unbindCarid" name="carid" value=""/>
            						</td>
            					</tr>
            					<tr class="even">
                					<td style="text-align: right;">车型<span class="fill-must">*</span></td>
                					<td class="even">
                						<select id="editPCartype" name="cartype" class="m-wrap span8" style="margin-top: 10px" placeholder="" disabled="disabled">
                							<option value="">===请选择===</option>
												<#if cartypeList?exists>
													<#list cartypeList as ctlist>
														<option value="${ctlist.getKey()}"><#if ctlist.getName()?exists>${ctlist.getName()}</#if></option>
													</#list>
												</#if>
                						</select>
                					</td>
                				</tr>
                				<tr class="even">
                					<td style="text-align: right;">首末次免费<span class="fill-must">*</span></td>
									<td class="even">
										<label class="radio-inline">
											<input id="1" type="radio" name="free" value="1" disabled> 都免费
										</label>
										<label class="radio-inline">
											<input id="2" type="radio" name="free" value="2" disabled> 仅首次免费
										</label>
										<label class="radio-inline">
											<input id="3" type="radio" name="free" value="3" disabled> 仅末次免费
										</label>
										<label class="radio-inline">
											<input id="4" type="radio" name="free" value="4" disabled> 都不免费
										</label>
								 	</td>
                				</tr>
                				<tr id="firstfee" class="even">
								 	<td style="text-align: right;">首次免费价格<span class="fill-must">*</span></td>
								 	<td class="even">
                						<input id="unbindFirstfee" type="number" style="margin-top: 10px" readonly/> 元 / 次
								 	</td>
								</tr>
								<tr id="lastfee" class="even">
								 	<td style="text-align: right;">末次免费价格<span class="fill-must">*</span></td>
								 	<td class="even">
                						<input id="unbindLastfee" type="number" style="margin-top: 10px" readonly/> 元 / 次
								 	</td>
								</tr>
								<tr class="even">
									<td style="text-align: right;">解绑原因</td>
									<td class="even">
										<textarea class="form-control" rows="3" id="unbindReason" name="unbindreason" placeholder=""></textarea>
									</td>
								</tr>
							</tbody>
						</table>
						<div class="controls controls-row" style="text-align: right;">
                        	<input id="unbind" type="button" value="解绑" class="btn green" onclick="unbindCar()"/>
                        	<input id="immediate" type="button" value="立即解绑" class="btn green" onclick="immediateUnbind()"/>
                        	<input type="button" value="取消" class="btn green" onclick="allDivHide()" />
                    	</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	
	<!-- 新增账户 -->
	<div id="addDiv" class="row-fluid" style="position: absolute;visibility: hidden;overflow: hidden;padding: 1px;z-index: 100;background-color: #FFFFFF;">
		<div class="span12">
			<div class="portlet box green" style="padding: 0px;margin:0px;">
				<div class="portlet-title">
                    <div class="caption"><i class="fa fa-edit"></i>新增账户</div>
                    <a href="javascript:allDivHide();" class="remove"></a>
                </div>
                
                <div class="portlet-body flip-scroll">
                	<form id="addForm" action="<@spring.url '/account_user_manage'></@spring.url>" method="POST">
                		<table class="table-bordered table-striped table-condensed flip-content">
                			<tbody role="alert" aria-live="polite" aria-relevant="all">
                				<tr class="even">
                					<td style="text-align: right;">账户类型</td>
                					<td class="center">
                						<label class="radio-inline">
				  							<input type="radio" name="type" class="role1Btn" id="radio1" value="0" checked="checked"> 个人
										</label>
										<label class="radio-inline">
				  							<input type="radio" name="type" class="role1Btn" id="radio2" value="1"> 公司
										</label>
                					</td>
                				</tr>
                				<!-- 个人 -->
                				<tr class="even private">
                					<td style="text-align: right;">姓名<span class="fill-must">*</span></td>
                					<td class="even">
                						<input class="m-wrap span8" style="margin-top: 10px" type="text" id="addName" name="name" placeholder="请输入账户姓名" required>
                					</td>
                				</tr>
                				<tr class="even private">
                					<td style="text-align: right;">手机号<span class="fill-must">*</span></td>
                            		<td class="even">
                                   		<input class="m-wrap span8" style="margin-top: 10px" type="text" id="addPhone" name="tel" placeholder="请输入手机号" required data-rule-remote="${base}/checkNameUnique?category=AccountUserTel&where=and del=0" data-msg-remote="手机号码已存在" data-rule-mobile="true" data-msg-mobile="请输入正确格式" required/>
                            		</td>
                				</tr>
                				<tr class="even private">
                					<td style="text-align: right;">身份证号<span class="fill-must">*</span></td>
                					<td id="checkid" class="even">
                						<input class="m-wrap span8" style="margin-top: 10px" type="text" id="addIdentity" name="identityid" placeholder="请输入身份证号" data-rule-idCard="true" data-msg-idCard="请输入正确格式" required/>
                					</td>
                				</tr>
                				<tr class="even private">
                					<td style="text-align: right;">所在地区<span class="fill-must">*</span></td>
                					<td class="even">
                						<select id="addProvince" name="provinceid" class="m-wrap span8" onchange="combox('addCity','City',$(this).val(),null,false)" required style="margin-top: 10px">
                						</select>
                						<select id="addCity" name="cityid" class="m-wrap span8" style="margin-top: 10px" required>
                						</select>
                					</td>
                				</tr>
                				
                				<!-- 公司 -->
                				<tr class="even company" style="display: none;">
                					<td style="text-align: right;">公司名称<span class="fill-must">*</span></td>
                            		<td class="even">
                                   		<input class="m-wrap span8" style="margin-top: 10px" type="text" id="addName" name="Cname" placeholder="请输入公司名称" required />
                            		</td>
                				</tr>
                				<tr class="even company" style="display: none;">
                					<td style="text-align: right;">接收短信手机<span class="fill-must">*</span></td>
                            		<td class="even">
                                   		<input class="m-wrap span8" style="margin-top: 10px" type="text" id="addPhone" name="Ctel" placeholder="请输入接收短信手机" required data-rule-remote="${base}/checkNameUnique?category=AccountUserTel&where=and del=0 and type=0" data-msg-remote="手机号码已存在" data-rule-mobile="true" data-msg-mobile="请输入正确格式"/>
                            		</td>
                				</tr>
                				<tr class="even company" style="display: none;">
                					<td style="text-align: right;">银行账号</td>
                            		<td id="checkbank" class="even">
                                   		<input class="m-wrap span8" style="margin-top: 10px" type="text" id="addBankNum" name="bank_num" placeholder="请输入银行账号"/>
                            		</td>
                				</tr>
                				<tr class="even company" style="display: none;">
                					<td style="text-align: right;">开户行</td>
                            		<td class="even">
                                   		<input class="m-wrap span8" style="margin-top: 10px" type="text" id="addBankAcc" name="bank_account" placeholder="请输入开户行"/>
                            		</td>
                				</tr>
                				<tr class="even company" style="display: none;">
                					<td style="text-align: right;">说明</td>
                            		<td class="even">
                                   		<textarea class="form-control" rows="3" id="addComment" name="comment" placeholder=""></textarea>
                            		</td>
                				</tr>
                			</tbody>
                		</table>
                		</br>
                		<div class="controls controls-row" style="text-align: right;">
                        	<input type="button" value="保存" class="btn green" onclick="addEntity()"/>
                        	<input type="button" value="取消" class="btn green" onclick="fresh()" />
                    	</div>
                	</form>
                </div>
			</div>
		</div>
	</div>
	
	<!-- 编辑个人账号 -->
	<div id="editPDiv" class="row-fluid" style="position: absolute;visibility: hidden;overflow: hidden;padding: 1px;z-index: 100;background-color: #FFFFFF;">
		<div class="span12">
        <div class="portlet box green" style="margin: -1px;">
            <div class="portlet-title">
                <div class="caption"><i class="icon-edit"></i>编辑账号</div>
                <a href="javascript:hideEditTable();" class="remove"></a>
            </div>
            
            <div class="portlet-body flip-scroll">
            	<form id="editPForm" action="<@spring.url '/edit_private_account_user'></@spring.url>" method="POST">
            	<table class="table-bordered table-striped table-condensed flip-content">
            		<tbody role="alert" aria-live="polite" aria-relevant="all">
            		<input type="hidden" id="editPId" name="id"/>
            		<tr class="even">
            			<td style="text-align: right;">账号</td>
            			<td class="even">
            				<span id="editPAccount"></span>
            			</td>
            		</tr>
            		<tr class="even">
            			<td style="text-align: right;">账户类型</td>
            			<td class="even">
            				<span id="editPType"></span>
            			</td>
            		</tr>
            		<tr class="even">
            			<td style="text-align: right;">姓名<span class="fill-must">*</span></td>
            			<td class="even">
            				<input class="m-wrap span8" style="margin-top: 10px" type="text" id="editName" name="name" placeholder="请输入账户姓名" required onkeyup="editformv.form();"/>
            			</td>
            		</tr>
            		<tr class="even">
            			<td style="text-align: right;">手机号<span class="fill-must">*</span></td>
            			<td class="even">
            				<input class="m-wrap span8" style="margin-top: 10px" type="text" id="editPTel" name="tel" placeholder="请输入手机号" required data-rule-remote="" data-msg-remote="手机号码已存在" data-rule-mobile="true" data-msg-mobile="请输入正确格式" required/>
            			</td>
            		</tr>
            		<tr class="even">
            			<td style="text-align: right;">身份证号<span class="fill-must">*</span></td>
            			<td id="checkeditid" class="even">
            				<input class="m-wrap span8" style="margin-top: 10px" type="text" id="editPIdentity" name="identityid" placeholder="请输入身份证号" data-rule-idCard="true" data-msg-idCard="请输入正确格式" required/>
            			</td>
            		</tr>
                	<tr class="even">
                		<td style="text-align: right;">所在地区<span class="fill-must">*</span></td>
                		<td class="even">
                			<select id="editProvince" name="provinceid" class="m-wrap span8" onchange="combox('editCity','City',$(this).val(),null,false)" required style="margin-top: 10px">
                			</select>
                			<select id="editCity" name="cityid" class="m-wrap span8" style="margin-top: 10px" required>
                			</select>
                		</td>
                	</tr>
            		</tbody>
            		</table>
            		<div class="controls controls-row" style="text-align: right;">
                        <input type="button" value="保存" class="btn green" onclick="updatePTable()"/>
                        <input type="button" value="取消" class="btn green" onclick="allDivHide()" />
                    </div>
            	</form>
            </div>
        </div>
        </div>
	</div>
	
	<!-- 编辑公司账号 -->
	<div id="editCDiv" class="row-fluid" style="position: absolute;visibility: hidden;overflow: hidden;padding: 1px;z-index: 100;background-color: #FFFFFF;">
		<div class="span12">
        <div class="portlet box green" style="margin: -1px;">
            <div class="portlet-title">
                <div class="caption"><i class="icon-edit"></i>编辑账号</div>
                <a href="javascript:hideEditTable();" class="remove"></a>
            </div>
            
            <div class="portlet-body flip-scroll">
            	<form id="editCForm" action="<@spring.url '/edit_company_account_user'></@spring.url>" method="POST">
            	<table class="table-bordered table-striped table-condensed flip-content">
            		<tbody role="alert" aria-live="polite" aria-relevant="all">
            		<input type="hidden" id="editCId" name="id">
            		<tr class="even">
            			<td style="text-align: right;">账号</td>
            			<td class="even">
            				<span id="editCAccount"></span>
            			</td>
            		</tr>
            		<tr class="even">
            			<td style="text-align: right;">账户类型</td>
            			<td class="even">
            				<span id="editCType"></span>
            			</td>
            		</tr>
            		<tr class="even">
            			<td style="text-align: right;">公司名称<span class="fill-must">*</span></td>
            			<td class="even">
            				<input class="m-wrap span8" style="margin-top: 10px" type="text" id="editCName" name="Cname" placeholder="请输入公司名称" required />
            			</td>
            		</tr>
            		<tr class="even">
            			<td style="text-align: right;">接收短信手机<span class="fill-must">*</span></td>
            			<td class="even">
            				<input class="m-wrap span8" style="margin-top: 10px" type="text" id="editCtel" name="Ctel" placeholder="请输入接收短信手机" required data-rule-remote="" data-msg-remote="手机号码已存在" data-rule-mobile="true" data-msg-mobile="请输入正确格式" />
            			</td>
            		</tr>
            		<tr class="even">
            			<td style="text-align: right;">银行账号</td>
            			<td id="checkeditbank" class="even">
            				<input class="m-wrap span8" style="margin-top: 10px" type="text" id="editBankNum" name="bank_num" placeholder="请输入银行账号"/>
            			</td>
            		</tr>
            		<tr class="even">
            			<td style="text-align: right;">开户行</td>
            			<td class="even">
            				<input class="m-wrap span8" style="margin-top: 10px" type="text" id="editBankAcc" name="bank_account" placeholder="请输入开户行"/>
            			</td>
            		</tr>
            		<tr class="even">
            			<td style="text-align: right;">说明</td>
                        <td class="even">
                            <textarea class="form-control" rows="3" id="editComment" name="comment" placeholder=""></textarea>
                        </td>
            		</tr>
            		</tbody>
            		</table>
            		<div class="controls controls-row" style="text-align: right;">
                        <input type="button" value="保存" class="btn green" onclick="updateCTable()"/>
                        <input type="button" value="取消" class="btn green" onclick="allDivHide()" />
                    </div>
            	</form>
            </div>
        </div>
        </div>
	</div>
	
	<!-- 优惠 -->
	<div id="couponDiv" class="row-fluid" style="position: absolute;visibility: hidden;overflow: hidden;padding: 1px;z-index: 100;background-color: #FFFFFF;">
		<div class="span12">
        <div class="portlet box green" style="margin: -1px;">
            <div class="portlet-title">
                <div class="caption"><i class="icon-edit"></i>匹配优惠</div>
                <a href="javascript:hideEditTable();" class="remove"></a>
            </div>
            
            <div class="portlet-body flip-scroll">
            	<form id="couponForm" action="<@spring.url 'batch_add_coupon'></@spring.url>" method="POST">
            	<table class="table-bordered table-striped table-condensed flip-content">
            		<tbody role="alert" aria-live="polite" aria-relevant="all">
            		<tr class="even">
            			<td style="text-align: right;">营销工具</td>
            			<td class="center">
                			<label class="radio-inline">
				  				<input type="radio" checked="checked"> 优惠券
				  				<input type="hidden" id="accid" name="accountid" />
							</label>
                		</td>
            		</tr>
            		<tr class="even">
            			<td style="text-align: right;"></td>
            			<td class="even">
            				<select id="couponid" name="couponid" class="m-wrap span8" style="margin-top: 10px" placeholder="" required>
                				<option value="">===请选择===</option>
									<#if couponList?exists>
										<#list couponList as cplist>
											<option value="${cplist.getKey()}"><#if cplist.getName()?exists>${cplist.getName()}</#if></option>
										</#list>
									</#if>
                			</select>
            			</td>
            		</tr>
            		</tbody>
            		</table>
            		<div class="controls controls-row" style="text-align: right;">
                        <input type="button" value="保存" class="btn green" onclick="addCoupon()"/>
                        <input type="button" value="取消" class="btn green" onclick="allDivHide()" />
                    </div>
            	</form>
            </div>
        </div>
        </div>
    </div>
    
    <!-- 匹配资费 -->
    <div id="postageDiv" class="row-fluid" style="position: absolute;visibility: hidden;overflow: hidden;padding: 1px;z-index: 100;background-color: #FFFFFF;">
    	<div class="span12">
    	<div class="portlet box green" style="margin: -1px;">
    		<div class="portlet-title">
                <div class="caption"><i class="icon-edit"></i>匹配资费</div>
                <a href="javascript:hideEditTable();" class="remove"></a>
            </div>
            
            <div class="portlet-body flip-scroll">
            	<form id="postageForm" action="<@spring.url 'match_postage'></@spring.url>" method="POST">
            	<table class="table-bordered table-striped table-condensed flip-content">
            		<tbody role="alert" aria-live="polite" aria-relevant="all">
            			<tr class="even">
                			<td style="text-align: right;">匹配资费</td>
                			<td class="center">
                				<!-- <label class="radio-inline">
				  					<input type="radio" name="postage_type" class="role2Btn" id="radio3" value="1" > 常规资费
								</label> -->
								<label class="radio-inline">
									<input type="hidden" id="accountid" name="accountid" />
                					<input type="hidden" id="action" name="action" />
				  					<input type="radio" name="postage_type" class="role2Btn" id="radio4" value="2" checked="checked"> 套餐
								</label>
                			</td>
                		</tr>
                		<!-- 常规资费 -->
                		<tr class="even conventional" style="display: none;">
                			<td style="text-align: right;"></td>
                			<td class="even">
            				<select id="CpostageId" name="CpostageId" class="m-wrap span8" style="margin-top: 10px" placeholder="" required>
                				<option value="">===请选择资费===</option>
                					<#if conList?exists>
										<#list conList as cnlist>
											<option value="${cnlist.getKey()}"><#if cnlist.getName()?exists>${cnlist.getName()}</#if></option>
										</#list>
									</#if>
                			</select>
            				</td>
                		</tr>
                		<!-- 套餐 -->
                		<tr class="even package">
                			<td style="text-align: right;"></td>
                			<td class="even">
            				<select id="PpostageId" name="PpostageId" class="m-wrap span8" style="margin-top: 10px" placeholder="" required>
                				<option value="">===请选择资费===</option>
                					<#if packList?exists>
										<#list packList as pklist>
											<option value="${pklist.getKey()}"><#if pklist.getName()?exists>${pklist.getName()}</#if></option>
										</#list>
									</#if>
                			</select>
            				</td>
                		</tr>
                		<tr class="even">
                			<td style="text-align: right;">选择车型</td>
                			<td class="even">
            				<select id="cartype" name="cartype" class="m-wrap span8" style="margin-top: 10px" placeholder="" required>
                				<option value="">===请选择车型===</option>
                			</select>
            				</td>
                		</tr>
            		</tbody>
            		</table>
            		<div class="controls controls-row" style="text-align: right;">
                        <input type="button" value="保存" class="btn green" onclick="matchPostage()"/>
                        <input type="button" value="取消" class="btn green" onclick="allDivHide()" />
                    </div>
                    <div class="form-group error-bar" style="display:none">
						<div class="col-sm-offset-4 col-sm-5 error-resgister">
							<span id="errorContent_zifei">已匹配资费点击保存修改资费</span>
						</div>
					</div>
            	</form>
            </div>
    	</div>
    	</div>
    </div>
    
    <!-- 二维码 -->
    <div id="qrcode" class="row-fluid" style="position: absolute;visibility: hidden;overflow: hidden;padding: 1px;z-index: 100;background-color: #FFFFFF;">
    	<div class="span12">
    	<div class="portlet box green" style="margin: -1px;">
    		<div class="portlet-title">
                <div class="caption"><i class="icon-edit"></i>二维码</div>
            </div>
            
            <div class="portlet-body flip-scroll">
            	<div id="code" class="codeBox"></div>
            	<div class="code_account"><span id="account"></span></div>
            	<div class="code_name"><span id="name"></span></div>
            	<div class="controls controls-row code_btn">
                     <input type="button" value="确定" class="btn green" onclick="allDivHide()" />
                </div>
            </div>
        </div>
        </div>
    </div>
	
<#include "bases/navhead.ftl">
<#include "bases/sidebar.ftl">

	<div class="page-container secMenu-content">    

     
        <div class="page-content">
     
            <div class="container-fluid">

                <div class="row-fluid">
                    <div class="span12">
                        <div class="portlet box green">
                            <div class="portlet-title">
                                <div class="caption"><i class="fa fa-cogs"></i>账户管理</div>
	                            <div class="tools">
	                                <a href="javascript:window.location.reload()" class="reload"></a>
	                            </div>
                            </div>
                            
                            <div class="portlet-body flip-scroll">
                            	<form id="searchform" action="<@spring.url '/account_user_manage'></@spring.url>" method="POST">
                            		<input  type="hidden" id="currentpage" name="page" value="0" />
                            		<input  type="hidden" id="postactionorder" name="postactionorder" />
           
                            		<div class="controls controls-row">
      									<label for="tel" class="">手机号：</label>
                            			<input type="text" name="tel" class="form-control sheet-searchInput" value="<#if tel?exists>${tel}</#if>">
                            			
                            			<label for="carbrand">车牌号：</label>
										<input type="text" name="carbrand" class="form-control sheet-searchInput" value="<#if carbrand?exists>${carbrand}</#if>">
										
										<label for="name">账户类型：</label>
										<select name="Acctype" class="form-control sheet-searchInput" value="${Acctype!}">
											<option value="">===请选择===</option>
	                                    	<#if typeList??>
	                                			<#list typeList as tlist> 
	                                    			<option value="${tlist.getKey()}" <#if (Acctype!'')=="${tlist.getKey()}">selected="selected"</#if>><#if tlist.getValue()??>${tlist.getValue()}</#if></option>
	                                			</#list>
                                  			</#if>
										</select>
									
										<label for="name">所属公司：</label>
										<select name="account" class="form-control sheet-searchInput" value="${account!}">
											<option value="">===请选择===</option>
				  							<#if companyList??>
	                                			<#list companyList as clist> 
	                                    			<option value="${clist.getName()}" <#if (account!'')=="${clist.getKey()}">selected="selected"</#if>><#if clist.getName()??>${clist.getName()}</#if></option>
	                                			</#list>
                                  			</#if>
										</select>
                            		</div>
                            		
                            		<div class="controls controls-row"  style="margin-top: 20px">
                            			<label for="name">车型：</label>
                            			<select name="cartype" class="form-control sheet-searchInput" value="${cartype!}">
											<option value="">===请选择===</option>
											<#if cartypeList??>
												<#list cartypeList as ctlist>
													<option value="${ctlist.getKey()}" <#if (cartype!'')=="${ctlist.getKey()}">selected="selected"</#if>><#if ctlist.getName()??>${ctlist.getName()}</#if></option>
												</#list>
											</#if>
										</select>
										
										<label for="name">城市：</label>
                						<select name="cityid" class="form-control sheet-searchInput" value="${cityid!}">
                							<option value="">===请选择===</option>
                							<#if cityList??>
												<#list cityList as Clist>
													<option value="${Clist.getKey()}" <#if (cityid!'')=="${Clist.getKey()}">selected="selected"</#if>><#if Clist.getName()??>${Clist.getName()}</#if></option>
												</#list>
											</#if>
                						</select>
                						
                						<label for="name">车辆状态：</label>
                						<select name="carstatus" class="form-control sheet-searchInput" value="${carstatus!}">
                							<option value="">===请选择===</option>
                							<#if statusList??>
												<#list statusList as CSlist>
													<option value="${CSlist.getKey()}" <#if (carstatus!'')=="${CSlist.getKey()}">selected="selected"</#if>><#if CSlist.getValue()??>${CSlist.getValue()}</#if></option>
												</#list>
											</#if>
                						</select>
				
										<button type="submit" class="btn blue">搜索</button>
									</div>
                            	    
                            	    <div class="controls controls-row"  style="margin-top: 20px">
                            	        <button type="button" class="btn green"  onclick="showPopup('addDiv')"><i class="fa fa-plus"></i>新增账户</button>
                            			<!-- <button type="button" class="btn blue"  onclick="batchPostage()">批量匹配资费</button> -->
                            			<button type="button" class="btn blue" onclick="batchActivity()">批量发放活动</button>
                            			<button type="button" class="btn blue" onclick="batchDel()">批量删除</button>
                            	    </div>
                            	    
                            		   <table  class="table table-bordered table-hover table-striped table-condensed list-table">
	      								  <thead class="flip-content">
	        								<tr>
	          									<th><input type="checkbox" class="checkbox-length list-checkboxAll"></th>
	          									<th style="text-align: center;">账号</th>
	          									<th style="text-align: center;">所属个人</th>
	          									<th style="text-align: center;">所属公司</th>
	          									<th style="text-align: center;">手机号</th>
	          									<th style="text-align: center;">账户类型</th>
	          									<th style="text-align: center;">车辆状态</th>
	          									<th style="text-align: center;">对应车牌</th>
	          									<th style="text-align: center;">所在地区</th>
	          									<th style="text-align: center;">当前套餐</th>
	          									<th class="am-obligate"></th>
	          									<th style="text-align: center;">操作人</th>
	          									<th style="text-align: center;">最后操作时间</th>
	          									<th style="text-align: center;width: 180px">操作</th>
	        								</tr>
	      								 </thead>
	      								 <tbody>
	      								 <#list account_users as item>
	      								 
	      								 	<tr>
	      								 		<#if item?exists>
	      								 		<th><input value="${item.getId()}" name="checklist" type="checkbox" class="list-checkbox"></th>
	          									<td style="text-align: center;"><#if item.getAccount()?exists>${item.getAccount()}</#if></td>
	          									<td style="text-align: center;"><#if item.getType()==0 && item.getName()?exists>${item.getName()}<#else></#if></td>
	          									<td style="text-align: center;"><#if item.getCompany()??>${item.getCompany()}<#else></#if></td>
	          									<td style="text-align: center;"><#if item.getTel()?exists>${item.getTel()}</#if></td>
	          									<td style="text-align: center;"><#if item.getType()==0>个人<#else>公司</#if></td>
	          									<td style="text-align: center;"><#if item.getCarstatus()??>${item.getCarstatus()}</#if></td>
	          									<td style="text-align: center;"><#if item.getCarbrand()?exists>${item.getCarbrand()}</#if></td>
	          									<td style="text-align: center;"><#if item.getCity()?exists>${item.getCity()}</#if></td>
	          									<td style="text-align: center;" <#if item.getType()==1>onmouseover="showInfo($('#${item.getId()}').val());" class="am-comboBtn"</#if>><#if item.getType()==1><input id="${item.getId()}" value="${item.getId()}" type="hidden">显示详情<#elseif item.getConventional()?exists><a href="">${item.getConventional()}</a>-${item.getCartypename()}<#elseif item.getPack()?exists><a href="${base}/view_package_fare?task=edit&id=${item.getPackid()}">${item.getPack()}</a>-${item.getCartypename()}</#if></td>
	          									<#if item.getType()==1>
	          									<td class="am-obligate">
		      										<div class="am-comboContent">
			      										<div class="arrow"></div>
			      										<div class="arrow2"></div>   
			       										<div class="am-comboDetails">
			        									</div>
		        									</div>
	          									</td>
	          									<#else>
	          									<td class="am-obligate"></td>
	          									</#if>
	          									<td style="text-align: center;"><#if item.getOperator()?exists>${item.getOperator()}</#if></td>
	          									<td style="text-align: center;"><#if item.getOperdate()?exists>${item.getOperdate()}</#if></td>
	          									<td style="text-align: center;">
	          									  <a id="editButton" onclick="showEditDiv('${item.getId()}');" class="bianji">编辑</a>
	          									  <#if item.getType()==0><#if item.getCarstatus()=='已绑定'><a id="unbindButton" onclick="showUnbind('${item.getId()}');" class="jiebang">解绑</a><#elseif item.getCarstatus()=='解绑中'><a id="immediateButton" onclick="showImmediate('${item.getId()}');" class="liji">立即解绑</a><#else><a id="bindButton" onclick="showBind('${item.getId()}');" class="bangding">绑定</a></#if></#if>
	          									  <a onclick="batchPostage('${item.getId()}','${item.getType()}')" class="zifei">匹配资费</a>
	          									  <a onclick="Activity('${item.getId()}');" class="youhui">优惠</a>
	          									  <a onclick="doDeleteTableRow('${item.getId()}');" class="delTr">删除</a>
	          									  <a onclick="qrcode('${item.getAccount()}','${item.getName()}');" class="qrcode">二维码</a>
	          									</td>
	          									</#if>
	      								 	</tr>
	      								 </#list>
	      								  </tbody>
	      							</table>
	      							<div class="controls controls-row">
                                    	<div id="Pagination" class="pagination"></div>
                            	</form>
                            </div>
                        </div>
                    </div>
                </div>
                
            </div>
            
        </div>
        
     </div>
     
</body>
